<script setup name="SubMenu">
defineProps({ data: Object, default: () => ({}) })
</script>

<template>
  <el-sub-menu :index="data.path">
    <template #title>{{ data.name }}</template>
    <template v-for="sub in data.children">
      <SubMenu v-if="sub.children && sub.children.length" :data="sub" :key="sub.path" />
      <el-menu-item v-else :index="sub.path" :key="sub.path">{{ sub.name }}</el-menu-item>
    </template>
  </el-sub-menu>
</template>

<style lang="scss" scoped></style>
